import type { App } from "vue"
import { createRouter, createWebHistory, type RouteRecordRaw } from "vue-router"
import { routes as staticRoutes } from "./static-routes"
import { setupRouterGuards } from "./guard"

const routes: RouteRecordRaw[] = staticRoutes

const router = createRouter({
    history: createWebHistory(),
    routes
})

export function setupRouter(app: App<Element>) {
    app.use(router)
    setupRouterGuards(router)
}

export default router
